package com.airtight.game;

import android.annotation.SuppressLint;
import android.content.Context;
import android.opengl.GLSurfaceView;
import android.util.Log;
import android.view.MotionEvent;


@SuppressLint("ViewConstructor")
public class MyGLSurfaceView extends GLSurfaceView{

    public GameRenderer Renderer;
    public boolean rendered = false;

    public MyGLSurfaceView(Context context, GameState gameState) {
        super(context);
        Log.d("SurfaceView","Created");
        setEGLContextClientVersion(2);     //Sets the OpenGL version to 2.
        Renderer = new GameRenderer(context, gameState);
        setRenderer(Renderer);             //sets the renderer to a custom renderer class
        rendered = true;
    }

    /*@Override
    public void surfaceDestroyed(SurfaceHolder holder) {
       Log.d("SurfaceView","Surface Destroyed");
    }*/

    @SuppressLint("ClickableViewAccessibility")
    @Override
    public boolean onTouchEvent(MotionEvent e) {
        Renderer.getScreenManager().getScreen().TouchEvent(e);
        return true;
    }
}
